Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make transport generic over its bag-of-bytes type #2155

Merged
merged 5 commits into from
Jan 17, 2025

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jan 14, 2025

Motivation:

The transport protocols deal in request/response part types. The bag-of-bytes message type used in [UInt8]. This means that transports might have to copy to and from the bag-of-bytes they use which is inefficient.

Modifications:

  • Add a GRPCContiguousBytes protocol defining a basic bag-of-bytes type.
  • Make the transport protocols have an associated Bytes type which conforms to GRPCContiguousBytes.
  • Propagate this requirement throughout the codebase; this affects the generated code.
  • Update the code generator to generate the appropriate code.
  • Update tests

Result:

  • Transports can use a bag-of-bytes type of their choosing.

Motivation:

The transport protocols deal in request/response part types. The
bag-of-bytes message type used in `[UInt8]`. This means that transports
might have to copy to and from the bag-of-bytes they use which is
inefficient.

Modifications:

- Add a `GRPCContiguousBytes` protocol defining a basic bag-of-bytes
  type.
- Make the transport protocols have an associated `Bytes` type which
  conforms to `GRPCContiguousBytes`.
- Propagate this requirement throughout the codebase; this affects the
  generated code.
- Update the code generator to generate the appropriate code.
- Update tests

Result:

- Transports can use a bag-of-bytes type of their choosing.
@glbrntt glbrntt merged commit 93d0536 into grpc:main Jan 17, 2025
30 of 33 checks passed
@glbrntt glbrntt deleted the v2/bag-o-bytes branch January 17, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ semver/major Breaks existing public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants